]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageList: Make canClear public and notify on changes
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 26 Feb 2017 21:23:11 +0000 (22:23 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 1 Mar 2017 09:52:43 +0000 (10:52 +0100)
The latest mockups contain a button to clear all sections at once.
As some elements cannot be cleared, we need to provide that information
to avoid offering an action that has no effect.

https://bugzilla.gnome.org/show_bug.cgi?id=775763

js/ui/messageList.js

index 325f5a3707606808691e34b0d7d4123879da9e10..9dde30941e67f4993826e686ceba50076cb03970 100644 (file)
@@ -563,6 +563,7 @@ const MessageListSection = new Lang.Class({
         this._messages = new Map();
         this._date = new Date();
         this.empty = true;
+        this.canClear = false;
         this._sync();
     },
 
@@ -719,7 +720,14 @@ const MessageListSection = new Lang.Class({
         if (changed)
             this.emit('empty-changed');
 
-        this._closeButton.visible = this._canClear();
+        let canClear = this._canClear();
+        changed = this.canClear !== canClear;
+        this.canClear = canClear;
+
+        if (changed)
+            this.emit('can-clear-changed');
+
+        this._closeButton.visible = this.canClear;
         this.actor.visible = this.allowed && this._shouldShow();
     }
 });